package com.drugStorage.struts.actions;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.drugStorage.domain.DetailDrugStorageList;
import com.drugStorage.domain.SumDrugStorageList;
import com.drugStorage.hibernate.dao.DetailDrugStorageListDao;
import com.drugStorage.hibernate.dao.SumDrugStorageListDao;

public class ShowDetailStorageAction extends DispatchAction {
	
	private DetailDrugStorageListDao detailDrugStorageListDao;



	public DetailDrugStorageListDao getDetailDrugStorageListDao() {
		return detailDrugStorageListDao;
	}



	public void setDetailDrugStorageListDao(
			DetailDrugStorageListDao detailDrugStorageListDao) {
		this.detailDrugStorageListDao = detailDrugStorageListDao;
	}



	@Override
	protected ActionForward unspecified(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		BeanFactory factory = new ClassPathXmlApplicationContext(
		"applicationContext-*.xml");
detailDrugStorageListDao = (DetailDrugStorageListDao) factory
		.getBean("detailDrugStorageListDao");

List<DetailDrugStorageList> deList= detailDrugStorageListDao.getDetailDrugStorageLists();

request.setAttribute("deList", deList);
		return mapping.findForward("Show_DetailStorageList");
	}
	
	

}
